home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / Batch / Saturation.ieb < prev    next >
Encoding:
Text File  |  1997-02-02  |  2.6 KB  |  106 lines

  1. /*
  2. ** $VER: Saturation.ieb 1.1, IE Arexx script
  3. ** Image Engineer Batch Processing script
  4. ** Copyright © by Patrik M Nydensten
  5. ** 25/1 1997 Stockholm/Sweden
  6. **
  7. ** Change image saturation.
  8. */
  9.  
  10. options results
  11. signal on error
  12.  
  13. parse arg input command
  14. input = upper(strip(input))
  15. address 'IMAGEENGINEER'
  16.  
  17. select  /* Required batch script commands */
  18.   when input = 'INFO' then    return get_info()
  19.   when input = 'CONFIG' then  return get_config(command)
  20.   when input = 'PROCESS' then return process_image(command)
  21.   otherwise do
  22.     'REQUEST' '"Failure in call to batch script!"' '" Quit "'
  23.     return '<ERROR>'
  24.   end
  25. end
  26.  
  27. exit 0
  28.  
  29. /* Required "Get_info" procedure  ------------------------------------ */
  30. /* S = SECONDARY, A = ALPHA, 1 = Single file, 2 = Multiple files       */
  31.  
  32. get_info:
  33.   back = 'OK'
  34. return back
  35.  
  36. /* Required "Get_config" procedure  ---------------------------------- */
  37.  
  38. get_config:
  39.   parse arg '"'command'"'
  40.  
  41.   NewSat=0
  42.  
  43.   if command ~= '' then parse var command NewSat
  44.  
  45.   'IE_TO_FRONT'
  46.  
  47.   'FORM "Saturation" " OK | Cancel "',
  48.   ' INTEGER,"Saturation",-255,255,'NewSat',SLIDER'
  49.  
  50.   parse var result ok NewSat
  51.   if ok = 0 then return '<ERROR>'
  52.  
  53.   back = NewSat
  54. return back
  55.  
  56. /* Required "Process_image" procedure  ------------------------------- */
  57.  
  58. process_image:
  59.   parse arg '"'src_image'"' '"'dst_image'"' '"'options'"'
  60.   parse var options NewSat
  61.  
  62.   'OPEN' '"'src_image'"' '24'
  63.   if (RC ~= 0) then do
  64.     'IE_TO_FRONT'
  65.     'REQUEST' '"Failed to load image:' d2c(10)||src_image'"' '" OK "'
  66.     return '<ERROR>'
  67.   end
  68.   else LoadImage = result
  69.  
  70.   'SATURATION' LoadImage NewSat
  71.   OutputImage = result
  72.   'CLOSE' LoadImage
  73.  
  74.   if getclip('cfg_save_frmt')='' then setclip('cfg_save_frmt','ILBM CmpByteRun1')
  75.   'SAVE_DATA' OutputImage '"'dst_image'"' '"'getclip('cfg_save_frmt')'"'
  76.   if (RC ~= 0) then do
  77.     'IE_TO_FRONT'
  78.     'REQUEST' '"Failed to save image:' d2c(10)||dst_image'"' '" OK "'
  79.     return '<ERROR>'
  80.   end
  81.   'CLOSE' OutputImage
  82.  
  83.   back = 'OK'
  84. return back
  85.  
  86. /* Internal procedures  ---------------------------------------------- */
  87.  
  88. /*******************************************************************/
  89. /* This is where control goes when an error code is returned by IE */
  90. /* It puts up a message saying what happened and on which line     */
  91. /*******************************************************************/
  92.  
  93. error:
  94. if RC=5 then do
  95.     IE_TO_FRONT
  96.     LAST_ERROR
  97.     'REQUEST "'||RESULT||'"'
  98. end
  99. else do
  100.     IE_TO_FRONT
  101.     LAST_ERROR
  102.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
  103. end
  104.  
  105. return '<ERROR>'
  106.